export function formatBytes(bytes: number = 0, decimals = 2, suffix = '') {
  if (bytes === 0 || Number.isNaN(bytes)) {
    return `0 Bytes${suffix}`
  }
  const k = 1024
  const dm = decimals < 0 ? 0 : decimals
  const sizes = ['Bytes', 'KB', 'MB', 'GB']
  const i = Math.floor(Math.log(bytes) / Math.log(k))
  return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))}${sizes[i]}${suffix}`
}
